function addDblClickEventListener(oElement, fEventhandler, iTimeout) {
  var iMouseDowns = 0, iMouseUps = 0;
  function checkMouseDownEvent(event) {
    iMouseDowns++;setTimeout(function () {iMouseDowns--;}, iTimeout);
  }
  function checkMouseUpEvent(event) {
    iMouseUps++; setTimeout(function () {iMouseUps--;}, iTimeout);
    if (iMouseDowns == 2 && iMouseUps == 2) {
      fEventhandler(event);
    }
  }
  oElement.addEventListener("mousedown", checkMouseDownEvent, true);
  oElement.addEventListener("mouseup", checkMouseUpEvent, true);
}
